class Solution {
public:
    string sortVowels(string s) {
        string ret(s.size(), ' ');
        int count[128];
        for (int i = 0; i < s.size(); i++) {
            if (s[i] != 'a' && s[i] != 'A' && s[i] != 'e' && s[i] != 'E' &&
                s[i] != 'i' && s[i] != 'I' && s[i] != 'u' && s[i] != 'U' &&
                s[i] != 'o' && s[i] != 'O')
                ret[i] = s[i];
            else
                count[s[i]]++;
        }

        char ci = 0;
        for (int i = 0; i < s.size(); i++) {
            if (ret[i] == ' ') {
                while (count[ci] == 0)
                    ci++;
                ret[i] = ci;
                count[ci]--;
            }
        }
        return ret;
    }
};